package com.medical.doctor.service.impl;

import com.medical.doctor.entity.DoctorMessageEntity;
import com.medical.doctor.entity.PatientPatientEntity;
import com.medical.doctor.feign.PatientMedicalRecordFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.medical.common.utils.PageUtils;
import com.medical.common.utils.Query;

import com.medical.doctor.dao.ClinialDao;
import com.medical.doctor.entity.ClinialEntity;
import com.medical.doctor.service.ClinialService;


@Service("clinialService")
public class ClinialServiceImpl extends ServiceImpl<ClinialDao, ClinialEntity> implements ClinialService {

    @Autowired
    private ClinialDao clinialDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ClinialEntity> page = this.page(
                new Query<ClinialEntity>().getPage(params),
                new QueryWrapper<ClinialEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public ClinialEntity clinicalVoList() {

        ClinialEntity clinialEntity = new ClinialEntity();

        PatientPatientEntity patientPatientEntity = new PatientPatientEntity();

            DoctorMessageEntity doctorMessageEntity = new DoctorMessageEntity();

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String str = sdf.format(new Date());

        clinialEntity.setPatientName(patientPatientEntity.getPatientName());
        clinialEntity.setPatientAge(patientPatientEntity.getAge());
        clinialEntity.setInformation("医生我最近头疼");
        clinialEntity.setCreatedate(str);
        clinialEntity.setClinicalPrice(doctorMessageEntity.getConsultPrice());
        clinialDao.insert(clinialEntity);

        return clinialEntity;
        }

}